function e(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
        value: n,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : e[t] = n, e;
}

function t(e, t) {
    if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
}

Object.defineProperty(exports, "__esModule", {
    value: !0
});

exports.default = function n(a) {
    var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "searchbar", o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
    t(this, n), a.setData(e({}, r, {
        keyword: "",
        inputShowed: !1
    }));
    var i = "function" == typeof o.onKeywordInput;
    Object.assign(a, {
        $$searchbarInputTyping: function(t) {
            this.setData(e({}, r + ".keyword", t.detail.value)), i && o.onKeywordInput(t.detail.value);
        },
        $$searchbarClearInput: function() {
            this.setData(e({}, r + ".keyword", ""));
        },
        $$searchbarShowInput: function() {
            this.setData(e({}, r + ".inputShowed", !0));
        },
        $$searchbarHideInput: function() {
            var t;
            this.setData((t = {}, e(t, r + ".keyword", ""), e(t, r + ".inputShowed", !1), t));
        }
    });
};